package uinv.com.main;

import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.*;
import javax.ws.rs.core.*;

import net.sf.json.JSONObject;
import uinv.com.uitl.*;

@Path("/start")
public class DataManage {
	Uitl uitl = new Uitl();
	Date day = new Date();
	String num = null;
	String gmstrjson = "{\"8\":\"97\",\"9\":\"134\",\"10\":\"189\",\"11\":\"264\",\"12\":\"82\",\"13\":\"73\",\"14\":\"187\",\"15\":\"233\",\"16\":\"215\",\"17\":\"103\"}";
	String atmstrjson = "{\"0\":\"2\",\"1\":\"3\",\"2\":\"2\",\"3\":\"1\",\"4\":\"3\",\"5\":\"5\",\"6\":\"9\",\"7\":\"17\",\"8\":\"88\",\"9\":\"137\",\"10\":\"133\",\"11\":\"123\",\"12\":\"114\",\"13\":\"102\",\"14\":\"214\",\"15\":\"223\",\"16\":\"241\",\"17\":\"168\",\"18\":\"112\",\"19\":\"73\",\"20\":\"65\",\"21\":\"43\",\"22\":\"16\",\"23\":\"9\"}";
	String atm = "{\"0\":\"2\",\"1\":\"5\",\"2\":\"9\",\"3\":\"10\",\"4\":\"13\",\"5\":\"18\",\"6\":\"27\",\"7\":\"44\",\"8\":\"132\",\"9\":\"269\",\"10\":\"402\",\"11\":\"525\",\"12\":\"639\",\"13\":\"741\",\"14\":\"955\",\"15\":\"1178\",\"16\":\"1429\",\"17\":\"1587\",\"18\":\"1699\",\"19\":\"1772\",\"20\":\"1837\",\"21\":\"1880\",\"22\":\"1896\",\"23\":\"1905\"}";
	String gm = "{\"8\":\"97\",\"9\":\"231\",\"10\":\"420\",\"11\":\"684\",\"12\":\"766\",\"13\":\"839\",\"14\":\"1026\",\"15\":\"1259\",\"16\":\"1474\",\"17\":\"1577\"}";
	JSONObject atmjsons = JSONObject.fromObject(atm);
	JSONObject gmjsons = JSONObject.fromObject(gm);
	JSONObject gmjson = JSONObject.fromObject(gm);
	JSONObject atmjson = JSONObject.fromObject(atm);
	@Context
	HttpServletResponse response;

	@GET
	@Produces(MediaType.TEXT_PLAIN)
	public String getResult(@QueryParam("name") String name) {
		return result(name);
	}

	@POST
	@Produces(MediaType.TEXT_PLAIN)
	public String postResult(@QueryParam("name") String name) {
		return result(name);
	}

	private String result(String name) {
		response.setCharacterEncoding("UTF-8"); // 解决变量name含有中文时出现的乱码问题
		//交易量统计
		if ("jyl".equals(name)) {
			String rel = jyl();
			System.out.println("交易量统计==>获取成功===========>"+rel);
			return rel;
		}
		//温度
		if ("wd".equals(name)) {
			String rel =wd();
			System.out.println("温度==>获取成功===========>"+rel);
			return rel;
		}
		//湿度
		if ("sd".equals(name)) {
			String rel =sd();
			System.out.println("湿度==>获取成功===========>"+rel);
			return rel;
		}
		//成功率
		if ("cgl".equals(name)) {
			String rel =cgl();
			System.out.println("成功率==>获取成功===========>"+rel);
			return rel;
		}
		//响应率
		if ("xyl".equals(name)) {
			String rel =xyl();
			System.out.println("响应率==>获取成功===========>"+rel);
			return rel;
		}
		//柜面交易量
		if ("gm".equals(name)) {
			String rel =gm();
			System.out.println("柜面交易量==>获取成功===========>"+rel);
			return rel;
		}
		//atm交易量
		if ("atm".equals(name)) {
			String rel =atm();
			System.out.println("atm交易量==>atm获取成功===========>"+rel);
			return rel;
		}
		//数据初始化
		if ("init".equals(name)) {
			return init();
		}
		return null;
	}

	public String jyl() {
		if (Thisime("00:00-1:00")) {
			num = "{\"name\":[\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\"],\"柜面\":[0],\"ATM\":["+atmjson.getString("0")+"]}";
			return num;
		}
		if (Thisime("1:00-2:00")) {
			num = "{\"name\":[\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\"],\"柜面\":[0,0],\"ATM\":["+atmjson.getString("0")+","+atmjson.getString("1")+"]}";
			return num;
		}
		if (Thisime("2:00-3:00")) {
			num = "{\"name\":[\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\"],\"柜面\":[0,0,0],\"ATM\":["+atmjson.getString("0")+","+atmjson.getString("1")+","+atmjson.getString("2")+"]}";
			return num;
		}
		if (Thisime("3:00-4:00")) {
			num = "{\"name\":[\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\"],\"柜面\":[0,0,0,0],\"ATM\":["+atmjson.getString("0")+","+atmjson.getString("1")+","+atmjson.getString("2")+","+atmjson.getString("3")+"]}";
			return num;
		}
		if (Thisime("4:00-5:00")) {
			num = "{\"name\":[\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\"],\"柜面\":[0,0,0,0,0],\"ATM\":["+atmjson.getString("0")+","+atmjson.getString("1")+","+atmjson.getString("2")+","+atmjson.getString("3")+","+atmjson.getString("4")+"]}";
			return num;
		}
		if (Thisime("5:00-6:00")) {
			num = "{\"name\":[\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\"],\"柜面\":[0,0,0,0,0,0],\"ATM\":["+atmjson.getString("0")+","+atmjson.getString("1")+","+atmjson.getString("2")+","+atmjson.getString("3")+","+atmjson.getString("4")+","+atmjson.getString("5")+"]}";
			return num;
		}
		if (Thisime("6:00-7:00")) {
			num = "{\"name\":[\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\"],\"柜面\":[0,0,0,0,0,0,0],\"ATM\":["+atmjson.getString("0")+","+atmjson.getString("1")+","+atmjson.getString("2")+","+atmjson.getString("3")+","+atmjson.getString("4")+","+atmjson.getString("5")+","+atmjson.getString("6")+"]}";
			return num;
		}
		if (Thisime("7:00-8:00")) {
			num = "{\"name\":[\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\"],\"柜面\":[0,0,0,0,0,0,0,0],\"ATM\":["+atmjson.getString("0")+","+atmjson.getString("1")+","+atmjson.getString("2")+","+atmjson.getString("3")+","+atmjson.getString("4")+","+atmjson.getString("5")+","+atmjson.getString("6")+","+atmjson.getString("7")+"]}";
			return num;
		}
		if (Thisime("8:00-9:00")) {
			num = "{\"name\":[\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\"],\"柜面\":[0,0,0,0,0,0,0,0,"+gmjson.getString("8")+"],\"ATM\":["+atmjson.getString("0")+","+atmjson.getString("1")+","+atmjson.getString("2")+","+atmjson.getString("3")+","+atmjson.getString("4")+","+atmjson.getString("5")+","+atmjson.getString("6")+","+atmjson.getString("7")+","+atmjson.getString("8")+"]}";
			return num;
		}
		if (Thisime("9:00-10:00")) {
			num = "{\"name\":[\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\"],\"柜面\":[0,0,0,0,0,0,0,0,"+gmjson.getString("8")+","+gmjson.getString("9")+"],\"ATM\":["+atmjson.getString("0")+","+atmjson.getString("1")+","+atmjson.getString("2")+","+atmjson.getString("3")+","+atmjson.getString("4")+","+atmjson.getString("5")+","+atmjson.getString("6")+","+atmjson.getString("7")+","+atmjson.getString("8")+","+atmjson.getString("9")+"]}";
			return num;
		}
		if (Thisime("10:00-11:00")) {
			num = "{\"name\":[\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\"],\"柜面\":[0,0,0,0,0,0,0,0,"+gmjson.getString("8")+","+gmjson.getString("9")+","+gmjson.getString("10")+"],\"ATM\":["+atmjson.getString("0")+","+atmjson.getString("1")+","+atmjson.getString("2")+","+atmjson.getString("3")+","+atmjson.getString("4")+","+atmjson.getString("5")+","+atmjson.getString("6")+","+atmjson.getString("7")+","+atmjson.getString("8")+","+atmjson.getString("9")+","+atmjson.getString("10")+"]}";
			return num;
		}
		if (Thisime("11:00-12:00")) {
			num = "{\"name\":[\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\"],\"柜面\":[0,0,0,0,0,0,0,0,"+gmjson.getString("8")+","+gmjson.getString("9")+","+gmjson.getString("10")+","+gmjson.getString("11")+"],\"ATM\":["+atmjson.getString("0")+","+atmjson.getString("1")+","+atmjson.getString("2")+","+atmjson.getString("3")+","+atmjson.getString("4")+","+atmjson.getString("5")+","+atmjson.getString("6")+","+atmjson.getString("7")+","+atmjson.getString("8")+","+atmjson.getString("9")+","+atmjson.getString("10")+","+atmjson.getString("11")+"]}";
			return num;
		}
		if (Thisime("12:00-13:00")) {
			num = "{\"name\":[\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\"],\"柜面\":[0,0,0,0,0,0,0,0,"+gmjson.getString("8")+","+gmjson.getString("9")+","+gmjson.getString("10")+","+gmjson.getString("11")+","+gmjson.getString("12")+"],\"ATM\":["+atmjson.getString("0")+","+atmjson.getString("1")+","+atmjson.getString("2")+","+atmjson.getString("3")+","+atmjson.getString("4")+","+atmjson.getString("5")+","+atmjson.getString("6")+","+atmjson.getString("7")+","+atmjson.getString("8")+","+atmjson.getString("9")+","+atmjson.getString("10")+","+atmjson.getString("11")+","+atmjson.getString("12")+"]}";
			return num;
		}
		if (Thisime("13:00-14:00")) {
			num = "{\"name\":[\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\"],\"柜面\":[0,0,0,0,0,0,0,0,"+gmjson.getString("8")+","+gmjson.getString("9")+","+gmjson.getString("10")+","+gmjson.getString("11")+","+gmjson.getString("11")+","+gmjson.getString("12")+"],\"ATM\":["+atmjson.getString("0")+","+atmjson.getString("1")+","+atmjson.getString("2")+","+atmjson.getString("3")+","+atmjson.getString("4")+","+atmjson.getString("5")+","+atmjson.getString("6")+","+atmjson.getString("7")+","+atmjson.getString("8")+","+atmjson.getString("9")+","+atmjson.getString("10")+","+atmjson.getString("11")+","+atmjson.getString("12")+","+atmjson.getString("13")+"]}";
			return num;
		}
		if (Thisime("14:00-15:00")) {
			num = "{\"name\":[\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\"],\"柜面\":[0,0,0,0,0,0,0,0,"+gmjson.getString("8")+","+gmjson.getString("9")+","+gmjson.getString("10")+","+gmjson.getString("11")+","+gmjson.getString("11")+","+gmjson.getString("12")+","+gmjson.getString("13")+"],\"ATM\":["+atmjson.getString("0")+","+atmjson.getString("1")+","+atmjson.getString("2")+","+atmjson.getString("3")+","+atmjson.getString("4")+","+atmjson.getString("5")+","+atmjson.getString("6")+","+atmjson.getString("7")+","+atmjson.getString("8")+","+atmjson.getString("9")+","+atmjson.getString("10")+","+atmjson.getString("11")+","+atmjson.getString("12")+","+atmjson.getString("13")+","+atmjson.getString("14")+"]}";
			return num;
		}
		if (Thisime("15:00-16:00")) {
			num = "{\"name\":[\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\"],\"柜面\":[0,0,0,0,0,0,0,0,"+gmjson.getString("8")+","+gmjson.getString("9")+","+gmjson.getString("10")+","+gmjson.getString("11")+","+gmjson.getString("11")+","+gmjson.getString("12")+","+gmjson.getString("13")+","+gmjson.getString("14")+"],\"ATM\":["+atmjson.getString("0")+","+atmjson.getString("1")+","+atmjson.getString("2")+","+atmjson.getString("3")+","+atmjson.getString("4")+","+atmjson.getString("5")+","+atmjson.getString("6")+","+atmjson.getString("7")+","+atmjson.getString("8")+","+atmjson.getString("9")+","+atmjson.getString("10")+","+atmjson.getString("11")+","+atmjson.getString("12")+","+atmjson.getString("13")+","+atmjson.getString("14")+","+atmjson.getString("15")+"]}";
			return num;
		}
		if (Thisime("16:00-17:00")) {
			num = "{\"name\":[\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\"],\"柜面\":[0,0,0,0,0,0,0,0,"+gmjson.getString("8")+","+gmjson.getString("9")+","+gmjson.getString("10")+","+gmjson.getString("11")+","+gmjson.getString("11")+","+gmjson.getString("12")+","+gmjson.getString("13")+","+gmjson.getString("14")+","+gmjson.getString("15")+"],\"ATM\":["+atmjson.getString("0")+","+atmjson.getString("1")+","+atmjson.getString("2")+","+atmjson.getString("3")+","+atmjson.getString("4")+","+atmjson.getString("5")+","+atmjson.getString("6")+","+atmjson.getString("7")+","+atmjson.getString("8")+","+atmjson.getString("9")+","+atmjson.getString("10")+","+atmjson.getString("11")+","+atmjson.getString("12")+","+atmjson.getString("13")+","+atmjson.getString("14")+","+atmjson.getString("15")+","+atmjson.getString("16")+"]}";
			return num;
		}
		if (Thisime("17:00-18:00")) {
			num = "{\"name\":[\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\"],\"柜面\":[0,0,0,0,0,0,0,0,"+gmjson.getString("8")+","+gmjson.getString("9")+","+gmjson.getString("10")+","+gmjson.getString("11")+","+gmjson.getString("11")+","+gmjson.getString("12")+","+gmjson.getString("13")+","+gmjson.getString("14")+","+gmjson.getString("15")+","+gmjson.getString("16")+"],\"ATM\":["+atmjson.getString("0")+","+atmjson.getString("1")+","+atmjson.getString("2")+","+atmjson.getString("3")+","+atmjson.getString("4")+","+atmjson.getString("5")+","+atmjson.getString("6")+","+atmjson.getString("7")+","+atmjson.getString("8")+","+atmjson.getString("9")+","+atmjson.getString("10")+","+atmjson.getString("11")+","+atmjson.getString("12")+","+atmjson.getString("13")+","+atmjson.getString("14")+","+atmjson.getString("15")+","+atmjson.getString("16")+","+atmjson.getString("17")+"]}";
			return num;
		}
		if (Thisime("18:00-19:00")) {
			num = "{\"name\":[\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\"],\"柜面\":[0,0,0,0,0,0,0,0,"+gmjson.getString("8")+","+gmjson.getString("9")+","+gmjson.getString("10")+","+gmjson.getString("11")+","+gmjson.getString("11")+","+gmjson.getString("12")+","+gmjson.getString("13")+","+gmjson.getString("14")+","+gmjson.getString("15")+","+gmjson.getString("16")+","+gmjson.getString("17")+"],\"ATM\":["+atmjson.getString("0")+","+atmjson.getString("1")+","+atmjson.getString("2")+","+atmjson.getString("3")+","+atmjson.getString("4")+","+atmjson.getString("5")+","+atmjson.getString("6")+","+atmjson.getString("7")+","+atmjson.getString("8")+","+atmjson.getString("9")+","+atmjson.getString("10")+","+atmjson.getString("11")+","+atmjson.getString("12")+","+atmjson.getString("13")+","+atmjson.getString("14")+","+atmjson.getString("15")+","+atmjson.getString("16")+","+atmjson.getString("17")+","+atmjson.getString("18")+"]}";
			return num;
		}
		if (Thisime("19:00-20:00")) {
			num = "{\"name\":[\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\"],\"柜面\":[0,0,0,0,0,0,0,0,"+gmjson.getString("8")+","+gmjson.getString("9")+","+gmjson.getString("10")+","+gmjson.getString("11")+","+gmjson.getString("11")+","+gmjson.getString("12")+","+gmjson.getString("13")+","+gmjson.getString("14")+","+gmjson.getString("15")+","+gmjson.getString("16")+","+gmjson.getString("17")+","+gmjson.getString("17")+"],\"ATM\":["+atmjson.getString("0")+","+atmjson.getString("1")+","+atmjson.getString("2")+","+atmjson.getString("3")+","+atmjson.getString("4")+","+atmjson.getString("5")+","+atmjson.getString("6")+","+atmjson.getString("7")+","+atmjson.getString("8")+","+atmjson.getString("9")+","+atmjson.getString("10")+","+atmjson.getString("11")+","+atmjson.getString("12")+","+atmjson.getString("13")+","+atmjson.getString("14")+","+atmjson.getString("15")+","+atmjson.getString("16")+","+atmjson.getString("17")+","+atmjson.getString("18")+","+atmjson.getString("19")+"]}";
			return num;
		}
		if (Thisime("20:00-21:00")) {
			num = "{\"name\":[\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\"],\"柜面\":[0,0,0,0,0,0,0,0,"+gmjson.getString("8")+","+gmjson.getString("9")+","+gmjson.getString("10")+","+gmjson.getString("11")+","+gmjson.getString("11")+","+gmjson.getString("12")+","+gmjson.getString("13")+","+gmjson.getString("14")+","+gmjson.getString("15")+","+gmjson.getString("16")+","+gmjson.getString("17")+","+gmjson.getString("17")+","+gmjson.getString("17")+"],\"ATM\":["+atmjson.getString("0")+","+atmjson.getString("1")+","+atmjson.getString("2")+","+atmjson.getString("3")+","+atmjson.getString("4")+","+atmjson.getString("5")+","+atmjson.getString("6")+","+atmjson.getString("7")+","+atmjson.getString("8")+","+atmjson.getString("9")+","+atmjson.getString("10")+","+atmjson.getString("11")+","+atmjson.getString("12")+","+atmjson.getString("13")+","+atmjson.getString("14")+","+atmjson.getString("15")+","+atmjson.getString("16")+","+atmjson.getString("17")+","+atmjson.getString("18")+","+atmjson.getString("19")+","+atmjson.getString("20")+"]}";
			return num;
		}
		if (Thisime("21:00-22:00")) {
			num = "{\"name\":[\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\"],\"柜面\":[0,0,0,0,0,0,0,0,"+gmjson.getString("8")+","+gmjson.getString("9")+","+gmjson.getString("10")+","+gmjson.getString("11")+","+gmjson.getString("11")+","+gmjson.getString("12")+","+gmjson.getString("13")+","+gmjson.getString("14")+","+gmjson.getString("15")+","+gmjson.getString("16")+","+gmjson.getString("17")+","+gmjson.getString("17")+","+gmjson.getString("17")+","+gmjson.getString("17")+"],\"ATM\":["+atmjson.getString("0")+","+atmjson.getString("1")+","+atmjson.getString("2")+","+atmjson.getString("3")+","+atmjson.getString("4")+","+atmjson.getString("5")+","+atmjson.getString("6")+","+atmjson.getString("7")+","+atmjson.getString("8")+","+atmjson.getString("9")+","+atmjson.getString("10")+","+atmjson.getString("11")+","+atmjson.getString("12")+","+atmjson.getString("13")+","+atmjson.getString("14")+","+atmjson.getString("15")+","+atmjson.getString("16")+","+atmjson.getString("17")+","+atmjson.getString("18")+","+atmjson.getString("19")+","+atmjson.getString("20")+","+atmjson.getString("21")+"]}";
			return num;
		}
		if (Thisime("22:00-23:00")) {
			num = "{\"name\":[\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\"],\"柜面\":[0,0,0,0,0,0,0,0,"+gmjson.getString("8")+","+gmjson.getString("9")+","+gmjson.getString("10")+","+gmjson.getString("11")+","+gmjson.getString("11")+","+gmjson.getString("12")+","+gmjson.getString("13")+","+gmjson.getString("14")+","+gmjson.getString("15")+","+gmjson.getString("16")+","+gmjson.getString("17")+","+gmjson.getString("17")+","+gmjson.getString("17")+","+gmjson.getString("17")+","+gmjson.getString("17")+"],\"ATM\":["+atmjson.getString("0")+","+atmjson.getString("1")+","+atmjson.getString("2")+","+atmjson.getString("3")+","+atmjson.getString("4")+","+atmjson.getString("5")+","+atmjson.getString("6")+","+atmjson.getString("7")+","+atmjson.getString("8")+","+atmjson.getString("9")+","+atmjson.getString("10")+","+atmjson.getString("11")+","+atmjson.getString("12")+","+atmjson.getString("13")+","+atmjson.getString("14")+","+atmjson.getString("15")+","+atmjson.getString("16")+","+atmjson.getString("17")+","+atmjson.getString("18")+","+atmjson.getString("19")+","+atmjson.getString("20")+","+atmjson.getString("21")+","+atmjson.getString("22")+"]}";
			return num;
		}
		if (Thisime("23:00-00:00")) {
			num = "{\"name\":[\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"10\",\"11\",\"12\",\"13\",\"14\",\"15\",\"16\",\"17\",\"18\",\"19\",\"20\",\"21\",\"22\",\"23\"],\"柜面\":[0,0,0,0,0,0,0,0,"+gmjson.getString("8")+","+gmjson.getString("9")+","+gmjson.getString("10")+","+gmjson.getString("11")+","+gmjson.getString("11")+","+gmjson.getString("12")+","+gmjson.getString("13")+","+gmjson.getString("14")+","+gmjson.getString("15")+","+gmjson.getString("16")+","+gmjson.getString("17")+","+gmjson.getString("17")+","+gmjson.getString("17")+","+gmjson.getString("17")+","+gmjson.getString("17")+","+gmjson.getString("17")+"],\"ATM\":["+atmjson.getString("0")+","+atmjson.getString("1")+","+atmjson.getString("2")+","+atmjson.getString("3")+","+atmjson.getString("4")+","+atmjson.getString("5")+","+atmjson.getString("6")+","+atmjson.getString("7")+","+atmjson.getString("8")+","+atmjson.getString("9")+","+atmjson.getString("10")+","+atmjson.getString("11")+","+atmjson.getString("12")+","+atmjson.getString("13")+","+atmjson.getString("14")+","+atmjson.getString("15")+","+atmjson.getString("16")+","+atmjson.getString("17")+","+atmjson.getString("18")+","+atmjson.getString("19")+","+atmjson.getString("20")+","+atmjson.getString("21")+","+atmjson.getString("22")+","+atmjson.getString("23")+"]}";
			return num;
		}
		return null;
	}

	public String wd() {
		String num = uitl.sum(27, 24);
		String srt = "{\"value\": \""+num+"℃\"}";
		return srt;
		
	}

	public String sd() {
		String num = uitl.sum(52, 48);
		String srt = "{\"value\": \""+num+"%\"}";
		return srt;
	}

	public String cgl() {
		String num = uitl.sum(99, 98);
		String srt = "{\"value\": \""+num+"%\"}";
		return srt;
	}

	public String xyl() {
		String num = uitl.sum(89, 85);
		String srt = "{\"value\": \""+num+"%\"}";
		return srt;

	}
	public String gm() {
		if (Thisime("00:00-1:00")) {
			String num = "{\"value\": \"0\"}";
			return num;
		}
		if (Thisime("1:00-2:00")) {
			String num = "{\"value\": \"0\"}";
			return num;
		}
		if (Thisime("2:00-3:00")) {
			String num = "{\"value\": \"0\"}";;
			return num;
		}
		if (Thisime("3:00-4:00")) {
			String num = "{\"value\": \"0\"}";
			return num;
		}
		if (Thisime("4:00-5:00")) {
			String num = "{\"value\": \"0\"}";
			return num;
		}
		if (Thisime("5:00-6:00")) {
			String num = "{\"value\": \"0\"}";
			return num;
		}
		if (Thisime("6:00-7:00")) {
			String num = "{\"value\": \"0\"}";
			return num;
		}
		if (Thisime("7:00-8:00")) {
			String num = "{\"value\": \"0\"}";
			return num;
		}
		if (Thisime("8:00-9:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/gmdata.js");
			String numstr  = jsonObject.getString("8");
			String num = "{\"value\": \""+numstr+"\"}";
			return num;
		}
		if (Thisime("9:00-10:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/gmdata.js");
			String numstr  = jsonObject.getString("9");
			String num = "{\"value\": \""+numstr+"\"}";
			int numint = Integer.parseInt(numstr);
			numstr = Integer.toString(uitl.sumint(3, 1)+numint);
			jsonObject.put("9", numstr);
			boolean rel =uitl.writeFile(jsonObject.toString(),"d:/gmdata.js");
			System.out.println(rel);
			return num;
		}
		if (Thisime("10:00-11:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/gmdata.js");
			String numstr  = jsonObject.getString("10");
			String num = "{\"value\": \""+numstr+"\"}";
			int numint = Integer.parseInt(numstr);
			numstr = Integer.toString(uitl.sumint(4, 1)+numint);
			jsonObject.put("10", numstr);
			boolean rel =uitl.writeFile(jsonObject.toString(),"d:/gmdata.js");
			System.out.println(rel);
			return num;
		}
		if (Thisime("11:00-12:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/gmdata.js");
			String numstr  = jsonObject.getString("11");
			String num = "{\"value\": \""+numstr+"\"}";
			int numint = Integer.parseInt(numstr);
			numstr = Integer.toString(uitl.sumint(2, 1)+numint);
			jsonObject.put("11", numstr);
			boolean rel =uitl.writeFile(jsonObject.toString(),"d:/gmdata.js");
			System.out.println(rel);
			return num;
		}
		if (Thisime("12:00-13:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/gmdata.js");
			String numstr  = jsonObject.getString("12");
			String num = "{\"value\": \""+numstr+"\"}";
			int numint = Integer.parseInt(numstr);
			numstr = Integer.toString(uitl.sumint(3, 1)+numint);
			jsonObject.put("12", numstr);
			boolean rel =uitl.writeFile(jsonObject.toString(),"d:/gmdata.js");
			System.out.println(rel);
			return num;
		}
		if (Thisime("13:00-14:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/gmdata.js");
			String numstr  = jsonObject.getString("13");
			String num = "{\"value\": \""+numstr+"\"}";
			int numint = Integer.parseInt(numstr);
			numstr = Integer.toString(uitl.sumint(4, 1)+numint);
			jsonObject.put("13", numstr);
			boolean rel =uitl.writeFile(jsonObject.toString(),"d:/gmdata.js");
			System.out.println(rel);
			return num;
		}
		if (Thisime("14:00-15:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/gmdata.js");
			String numstr  = jsonObject.getString("14");
			String num = "{\"value\": \""+numstr+"\"}";
			int numint = Integer.parseInt(numstr);
			numstr = Integer.toString(uitl.sumint(3, 1)+numint);
			jsonObject.put("14", numstr);
			boolean rel =uitl.writeFile(jsonObject.toString(),"d:/gmdata.js");
			System.out.println(rel);
			return num;
		}
		if (Thisime("15:00-16:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/gmdata.js");
			String numstr  = jsonObject.getString("15");
			String num = "{\"value\": \""+numstr+"\"}";
			int numint = Integer.parseInt(numstr);
			numstr = Integer.toString(uitl.sumint(3, 1)+numint);
			jsonObject.put("15", numstr);
			boolean rel =uitl.writeFile(jsonObject.toString(),"d:/gmdata.js");
			System.out.println(rel);
			return num;
		}
		if (Thisime("16:00-17:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/gmdata.js");
			String numstr  = jsonObject.getString("16");
			String num = "{\"value\": \""+numstr+"\"}";
			int numint = Integer.parseInt(numstr);
			numstr = Integer.toString(uitl.sumint(2, 1)+numint);
			jsonObject.put("16", numstr);
			boolean rel =uitl.writeFile(jsonObject.toString(),"d:/gmdata.js");
			System.out.println(rel);
			return num;
		}
		if (Thisime("17:00-18:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/gmdata.js");
			String numstr  = jsonObject.getString("17");
			String num = "{\"value\": \""+numstr+"\"}";
			return num;
		}
		if (Thisime("18:00-19:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/gmdata.js");
			String numstr  = jsonObject.getString("17");
			String num = "{\"value\": \""+numstr+"\"}";
			return num;
		}
		if (Thisime("19:00-20:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/gmdata.js");
			String numstr  = jsonObject.getString("17");
			String num = "{\"value\": \""+numstr+"\"}";
			return num;
		}
		if (Thisime("20:00-21:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/gmdata.js");
			String numstr  = jsonObject.getString("17");
			String num = "{\"value\": \""+numstr+"\"}";
			return num;
		}
		if (Thisime("21:00-22:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/gmdata.js");
			String numstr  = jsonObject.getString("17");
			String num = "{\"value\": \""+numstr+"\"}";
			return num;
		}
		if (Thisime("22:00-23:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/gmdata.js");
			String numstr  = jsonObject.getString("17");
			String num = "{\"value\": \""+numstr+"\"}";
			return num;
		}
		if (Thisime("23:00-00:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/gmdata.js");
			String numstr  = jsonObject.getString("17");
			String num = "{\"value\": \""+numstr+"\"}";
			return num;
		}
		return null;

	}
	public String atm() {
		if (Thisime("00:00-1:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/atmdata.js");
			String numstr  = jsonObject.getString("0");
			String num = "{\"value\": \""+numstr+"\"}";
			return num;
		}
		if (Thisime("1:00-2:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/atmdata.js");
			String numstr  = jsonObject.getString("1");
			String num = "{\"value\": \""+numstr+"\"}";
			return num;
		}
		if (Thisime("2:00-3:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/atmdata.js");
			String numstr  = jsonObject.getString("2");
			String num = "{\"value\": \""+numstr+"\"}";
			return num;
		}
		if (Thisime("3:00-4:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/atmdata.js");
			String numstr  = jsonObject.getString("3");
			String num = "{\"value\": \""+numstr+"\"}";
			return num;
		}
		if (Thisime("4:00-5:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/atmdata.js");
			String numstr  = jsonObject.getString("4");
			String num = "{\"value\": \""+numstr+"\"}";
			return num;
		}
		if (Thisime("5:00-6:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/atmdata.js");
			String numstr  = jsonObject.getString("5");
			String num = "{\"value\": \""+numstr+"\"}";
			return num;
		}
		if (Thisime("6:00-7:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/atmdata.js");
			String numstr  = jsonObject.getString("6");
			String num = "{\"value\": \""+numstr+"\"}";
			return num;
		}
		if (Thisime("7:00-8:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/atmdata.js");
			String numstr  = jsonObject.getString("7");
			String num = "{\"value\": \""+numstr+"\"}";
			return num;
		}
		if (Thisime("8:00-9:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/atmdata.js");
			String numstr  = jsonObject.getString("8");
			String num = "{\"value\": \""+numstr+"\"}";
			return num;
		}
		if (Thisime("9:00-10:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/atmdata.js");
			String numstr  = jsonObject.getString("9");
			String num = "{\"value\": \""+numstr+"\"}";
			int numint = Integer.parseInt(numstr);
			numstr = Integer.toString(uitl.sumint(3, 1)+numint);
			jsonObject.put("9", numstr);
			boolean rel =uitl.writeFile(jsonObject.toString(),"d:/atmdata.js");
			System.out.println(rel);
			return num;
		}
		if (Thisime("10:00-11:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/atmdata.js");
			String numstr  = jsonObject.getString("10");
			String num = "{\"value\": \""+numstr+"\"}";
			int numint = Integer.parseInt(numstr);
			numstr = Integer.toString(uitl.sumint(3, 1)+numint);
			jsonObject.put("10", numstr);
			boolean rel =uitl.writeFile(jsonObject.toString(),"d:/atmdata.js");
			System.out.println(rel);
			return num;
		}
		if (Thisime("11:00-12:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/atmdata.js");
			String numstr  = jsonObject.getString("11");
			String num = "{\"value\": \""+numstr+"\"}";
			int numint = Integer.parseInt(numstr);
			numstr = Integer.toString(uitl.sumint(3, 1)+numint);
			jsonObject.put("11", numstr);
			boolean rel =uitl.writeFile(jsonObject.toString(),"d:/atmdata.js");
			System.out.println(rel);
			return num;
		}
		if (Thisime("12:00-13:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/atmdata.js");
			String numstr  = jsonObject.getString("12");
			String num = "{\"value\": \""+numstr+"\"}";
			int numint = Integer.parseInt(numstr);
			numstr = Integer.toString(uitl.sumint(3, 1)+numint);
			jsonObject.put("12", numstr);
			boolean rel =uitl.writeFile(jsonObject.toString(),"d:/atmdata.js");
			System.out.println(rel);
			return num;
		}
		if (Thisime("13:00-14:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/atmdata.js");
			String numstr  = jsonObject.getString("13");
			String num = "{\"value\": \""+numstr+"\"}";
			int numint = Integer.parseInt(numstr);
			numstr = Integer.toString(uitl.sumint(3, 1)+numint);
			jsonObject.put("13", numstr);
			boolean rel =uitl.writeFile(jsonObject.toString(),"d:/atmdata.js");
			System.out.println(rel);
			return num;
		}
		if (Thisime("14:00-15:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/atmdata.js");
			String numstr  = jsonObject.getString("14");
			String num = "{\"value\": \""+numstr+"\"}";
			int numint = Integer.parseInt(numstr);
			numstr = Integer.toString(uitl.sumint(3, 1)+numint);
			jsonObject.put("14", numstr);
			boolean rel =uitl.writeFile(jsonObject.toString(),"d:/atmdata.js");
			System.out.println(rel);
			return num;
		}
		if (Thisime("15:00-16:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/atmdata.js");
			String numstr  = jsonObject.getString("15");
			String num = "{\"value\": \""+numstr+"\"}";
			int numint = Integer.parseInt(numstr);
			numstr = Integer.toString(uitl.sumint(3, 1)+numint);
			jsonObject.put("15", numstr);
			boolean rel =uitl.writeFile(jsonObject.toString(),"d:/atmdata.js");
			System.out.println(rel);
			return num;
		}
		if (Thisime("16:00-17:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/atmdata.js");
			String numstr  = jsonObject.getString("16");
			String num = "{\"value\": \""+numstr+"\"}";
			int numint = Integer.parseInt(numstr);
			numstr = Integer.toString(uitl.sumint(3, 1)+numint);
			jsonObject.put("16", numstr);
			boolean rel =uitl.writeFile(jsonObject.toString(),"d:/atmdata.js");
			System.out.println(rel);
			return num;
		}
		if (Thisime("17:00-18:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/atmdata.js");
			String numstr  = jsonObject.getString("17");
			String num = "{\"value\": \""+numstr+"\"}";
			return num;
		}
		if (Thisime("18:00-19:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/atmdata.js");
			String numstr  = jsonObject.getString("18");
			String num = "{\"value\": \""+numstr+"\"}";
			return num;
		}
		if (Thisime("19:00-20:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/atmdata.js");
			String numstr  = jsonObject.getString("19");
			String num = "{\"value\": \""+numstr+"\"}";
			return num;
		}
		if (Thisime("20:00-21:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/atmdata.js");
			String numstr  = jsonObject.getString("20");
			String num = "{\"value\": \""+numstr+"\"}";
			return num;
		}
		if (Thisime("21:00-22:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/atmdata.js");
			String numstr  = jsonObject.getString("21");
			String num = "{\"value\": \""+numstr+"\"}";
			return num;
		}
		if (Thisime("22:00-23:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/atmdata.js");
			String numstr  = jsonObject.getString("22");
			String num = "{\"value\": \""+numstr+"\"}";
			return num;
		}
		if (Thisime("23:00-00:00")) {
			JSONObject jsonObject = uitl.readTxtFileIntoStringArrList("d:/atmdata.js");
			String numstr  = jsonObject.getString("23");
			String num = "{\"value\": \""+numstr+"\"}";
			return num;
		}
		return null;

	}
	
	public String init() {
        //判断路径是否存在，如果不存在就创建一个
		if (initfile()&&initfiles()) {
			return "数据初始化成功";
		}
		return "数据初始化失败";
	}
	
	public boolean initfile() {
		boolean rel =false;
		String atmstr = atmjsons.toString();
		File filepath = new File("d:/atmdata.js");
		if (!filepath.exists()) {
			try {
				filepath.createNewFile();
				rel =uitl.writeFile(atmstr,"d:/atmdata.js");
			} catch (IOException e) {
				// TODO Auto-generated catch block
				System.out.println("初始化文件创建失败");
			}
		}
		rel =uitl.writeFile(atmstr,"d:/atmdata.js");
		return rel;
	}
	public boolean initfiles() {
		boolean rel =false;
		String gmstr = gmjsons.toString();
		File filepath = new File("d:/gmdata.js");
		if (!filepath.exists()) {
			try {
				filepath.createNewFile();
				rel =uitl.writeFile(gmstr,"d:/gmdata.js");
			} catch (IOException e) {
				// TODO Auto-generated catch block
				System.out.println("初始化文件创建失败");
			}
		}
		rel =uitl.writeFile(gmstr,"d:/gmdata.js");
		return rel;
	}
	

	public boolean Thisime(String thistime) {
		SimpleDateFormat df = new SimpleDateFormat("HH:mm");
		boolean rel = uitl.isInTime(thistime, df.format(day));
		return rel;
	}
}
